package funjava;

/**
 * Created by judasnow on 5/25/16.
 */


import java.util.ArrayList;

/**
 * 第一种方案 使用一个外部的返回类
 */
class DigitSeq implements IntSequence {
    ArrayList<Integer> seq;
    int index = 0;

    public DigitSeq(int[] _seq) {
        for (int i: _seq) {
            seq.add(i);
        }
    }

    @Override
    public boolean hasNext() {
        try {
            seq.get(index + 1);
            return true;
        } catch (IndexOutOfBoundsException e) {
            return false;
        }
    }

    @Override
    public int next() {
        return 1;
    }
}


interface IntSequence {
    boolean hasNext();
    int next();

    //public static IntSequence of (int[] arr) {
    //}
}

public class C4_4 {
    public static void main(String[] args) {

    }
}
